home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3968 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.5 KB

  1. Path: news.uh.edu!usenet
  2. From: Sensarn <txs53132@bayou.uh.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: How do I make a virtual screen in Turbo C++?
  5. Date: 27 Jan 1996 00:49:22 GMT
  6. Organization: AEtna Insurance Agency
  7. Message-ID: <4ebsqi$pp0@masala.cc.uh.edu>
  8. References: <4e94jd$rte@maureen.teleport.com>
  9. NNTP-Posting-Host: sip-14260.public-dialups.uh.edu
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1 (Windows; U; 16bit)
  14.  
  15. Here is a standard double buffering technique:
  16.  
  17. //Allocate memory for double buffer
  18. unsigned char far *double_buffer=(unsigned char far *)farmalloc(64001);
  19. //Pointer to the video memory
  20. unsigned char far *video_buffer=(unsigned char far *)0xA0000000;
  21. //Screen 13h
  22. asm {
  23.     mov ax,0x13;Store screen mode in AX
  24.     int 0x10;interrupt 10h -- video stuff
  25. }
  26. //Load screen
  27. asm {
  28.     les di,double_buffer;ES:DI destination points to double_buffer
  29.     lds si,video_buffer;DS:SI source points to video_buffer
  30.     mov cx,32000;32000 words to move
  31.     cld;Clear the direction flag -- in case you are pointing backward
  32.     rep movsw;Move DS:SI to ES:DI one word at a time -- inc's SI
  33. }
  34. //Double buffer now contains screen
  35. //Clear screen
  36. asm {
  37.     les di,video_buffer
  38.     mov cx,32000
  39.     xor ax,ax;AX is value to write -- 0h is black
  40.     cld
  41.     rep stosw;Store AX in ES:DI -- inc's DI
  42. }
  43. //Display double buffer
  44. asm {
  45.     les di,video_buffer
  46.     lds si,double_buffer
  47.     mov cx,32000
  48.     cld
  49.     rep movsw
  50. }
  51.  
  52. Steven Sensarn - txs53132@bayou.uh.edu  
  53.  
  54.